package com.xmg.p2p.base.controller;

import com.xmg.p2p.base.service.EmailService;
import com.xmg.p2p.base.util.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @BelongsProject: jinrong-website
 * @BelongsPackage: com.xmg.p2p.base.controller
 * @author: Andy
 * @date: 2021.3.15 10:01
 * @Description: 邮箱的控制器
 * @since JDK 1.8
 */
@Controller
public class SendEmailController {
    @Autowired
    private EmailService emailService;
    @ResponseBody
    @RequestMapping("/sendEmail")
    public JSONResult sendEmail(String email){
        JSONResult jsonResult = new JSONResult();
        try {
            emailService.sendVerifyEmail(email);
        }catch (Exception e){
            jsonResult.setSuccess(false);
            jsonResult.setMsg("绑定错误");
            e.printStackTrace();
        }
        return jsonResult;
    }
}
